package com.xiaoxiong.text;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.xiaoxiong.bean.ScheduleCourseData;

public class showCourseInfo extends AlertDialog implements
		android.view.View.OnClickListener {

	private ScheduleCourseData coursedata;
	private TextView coursename;
	private TextView class_time;
	private TextView teacher;
	private TextView room;
	private TextView weeks;
	private LinearLayout closeLinear;

	public showCourseInfo(Context context, ScheduleCourseData coursedata) {
		super(context);
		this.coursedata = coursedata;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.show_course_info);

		coursename = (TextView) findViewById(R.id.coursename_tv);
		class_time = (TextView) findViewById(R.id.class_time_tv);
		teacher = (TextView) findViewById(R.id.teacher_tv);
		room = (TextView) findViewById(R.id.room_tv);
		weeks = (TextView) findViewById(R.id.weeks_tv);
		closeLinear = (LinearLayout) findViewById(R.id.close_linear);

		closeLinear.setOnClickListener(this);

		showInfo();

	}

	public void showInfo() {
		coursename.setText(coursedata.getCourseName());
		class_time.setText("星期" + coursedata.getWeek() + "\n" + coursedata.getTime());
		teacher.setText(coursedata.getTeacher());
		room.setText(coursedata.getRoom());
		weeks.setText(coursedata.getStringweeks());
	}

	@Override
	public void onClick(View arg0) {
		switch (arg0.getId()) {
		case R.id.close_linear:

			if (this != null && this.isShowing()) {
				this.dismiss();
			}
		}
	}

}
